<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
        <script>
            function refreshcheckcode(obj){
                obj.src="{%url 'captcha_demo_app:captcha_img'%}?r="+Math.random()
            }
        </script>
</head>
<body>
    <form method="post" action="{% url 'captcha_demo_app:login' %}">
    {% csrf_token %}
    <table>
        <tr>
            <td><label>用户名：<input type="text" value="" name="username" id="username"></label></td>
        </tr>
        <tr>
            <td><label>密码：<input type="password" value="" name="password" id="password"></label></td>
        </tr>
        <tr>
            <td>
                <label>验证码：
                    <input type="text" placeholder="请输入验证码" name="checkcode">
                </label>
{#                 <img src="{% url 'captcha_demo_app:captcha_img' %}">#}
                   <img src="{% url 'captcha_demo_app:captcha_img' %}" onclick="refreshcheckcode(this);">
            </td>
        </tr>

        {% if error_message %}
            <tr>
                <td colspan="2"><strong>{{ error_message }}</strong></td>
            </tr>
        {% endif %}
        <tr>
            <td colspan="2">
                <input type="submit" value="登录">
            </td>
        </tr>
    </table>
</form>
</body>
</html>